import { type Ref, ref, computed, h, Fragment } from "vue";
import type { PlusColumn, FieldValues, OptionsRow } from "plus-pro-components";
import { ElUpload, ElButton } from "element-plus";
import { getToken, formatToken } from "@/utils/auth";
import { message } from "@/utils/message";
import { getUsers } from "@/api/zhaoyuan";
const { token } = getToken();
export function useFormPassword() {
  const formPasswordRules = {
    oldPassword: [
      {
        required: true,
        message: "请输入旧密码"
      }
    ],
    newPassword: [
      {
        required: true,
        message: "请输入新密码"
      }
    ]
  };
  const formPasswordColumns: PlusColumn[] = [
    {
      label: "旧密码",
      prop: "oldPassword",
      type: "password"
    },
    {
      label: "新密码",
      prop: "newPassword",
      type: "password"
    }
  ];
  const formPasswordId = ref<number>(0);
  const formPasswordVisible = ref(false);
  const formPasswordValues = ref<FieldValues>({});
  const formPasswordOpen = async row => {
    formPasswordId.value = row.id;
    formPasswordValues.value = {};
    formPasswordVisible.value = true;
  };

  return {
    formPasswordRules,
    formPasswordColumns,
    formPasswordVisible,
    formPasswordValues,
    formPasswordOpen,
    formPasswordId
  };
}
